package nl.hu.verbrandendephoenix.view;

import java.util.ArrayList;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

public class ViewProduct {
	
	private Panel pnlViewProduct;
	private Grid grdViewProduct, grdButtons;
	private Label lblProductName, lblDescription, lblPrice, lblCategory, lblOwner, lblCurrentOffer, lblOffer, lblStartDate, lblEndDate;
	private TextBox txtOffer;
	private Button btnBid, btnCancel;
	
	public ViewProduct() {
		pnlViewProduct = new VerticalPanel();
		pnlViewProduct.addStyleName("post");
	}
	
	public Panel constructForm() {
		grdViewProduct = new Grid(7,3);
		grdButtons = new Grid(2, 2);
		
		lblProductName = new Label();
		lblDescription = new Label();
		lblPrice = new Label();
		lblCategory = new Label();
		lblOwner = new Label();
		lblCurrentOffer = new Label();
		lblOffer = new Label("Bied: \u20AC");
		lblStartDate = new Label();
		lblEndDate = new Label();
		
		txtOffer = new TextBox();
		txtOffer.setSize("35px", "20px");
		
		btnBid = new Button("Bid");
		btnCancel = new Button("Cancel");
		
		grdButtons.setWidget(0, 0, lblOffer);
		grdButtons.setWidget(0, 1, txtOffer);
		grdButtons.setWidget(1, 0, btnBid);
		grdButtons.setWidget(1, 1, btnCancel);
		
		pnlViewProduct.add(grdViewProduct);
		pnlViewProduct.add(grdButtons);
		
		return pnlViewProduct;
	}
	
	public ArrayList<TextBox> getArrTextBox() {
		ArrayList<TextBox> arrTextBox = new ArrayList<TextBox>();
		arrTextBox.add(txtOffer);
		return arrTextBox;
	}
	
	public Label getLblProductName() {
		return lblProductName;
	}

	public void setLblProductName(Label lblProductName) {
		grdViewProduct.setWidget(0, 0, lblProductName);
	}

	public Label getLblDescription() {
		return lblDescription;
	}

	public void setLblDescription(Label lblDescription) {
		grdViewProduct.setWidget(1, 0, lblDescription);
	}

	public Label getLblPrice() {
		return lblPrice;
	}

	public void setLblPrice(Label lblPrice) {
		grdViewProduct.setWidget(2, 0, lblPrice);
	}

	public Label getLblCategory() {
		return lblCategory;
	}

	public void setLblCategory(Label lblCategory) {
		grdViewProduct.setWidget(3, 0, lblCategory);
	}

	public Label getLblOwner() {
		return lblOwner;
	}

	public void setLblOwner(Label lblOwner) {
		grdViewProduct.setWidget(4, 0, lblOwner);
	}

	public Label getLblCurrentOffer() {
		return lblCurrentOffer;
	}

	public void setLblCurrentOffer(Label lblCurrentOffer) {
		grdViewProduct.setWidget(2, 1, lblCurrentOffer);
	}

	public Label getLblStartDate() {
		return lblStartDate;
	}

	public void setLblStartDate(Label lblStartDate) {
		grdViewProduct.setWidget(5, 0, lblStartDate);
	}

	public Label getLblEndDate() {
		return lblEndDate;
	}

	public void setLblEndDate(Label lblEndDate) {
		grdViewProduct.setWidget(5, 1, lblEndDate);
	}
	
	public TextBox getTxtOffer() {
		return txtOffer;
	}
	
	public void setTxtOffer(String text) {
		txtOffer.setText(text);
	}
	
	public Button getBtnBid() {
		return btnBid;
	}
	
	public Button getBtnCancel() {
		return btnCancel;
	}
}
